package com.vito.oa.act.statistics;

import com.vito.oa.act.constant.OaActContants;
/**
 * 统计的流程枚举
 * @author xuezhennan
 * 
 */
public enum ProcStatsEnum {
	/**
	 * 请假流程
	 */
	LEAVE("leave", "请假", "leave", "leave_id", "leave_day", "请假天数/天"), 
	/**
	 * 加班流程
	 */
	OVERTIME("overtime", "加班", "overtime","overtime_id", "overtime_time", "加班时长/小时"),
	/**
	 * 外出
	 */
	GOOUT("goOut","外出","goout","go_out_id","time","外出时长/小时"),
	/**
	 * 出差
	 */
	EVECTION("evection","出差","base_evection","id","evection_day","出差天数/天"),
	
	/**
	 * 报销流程
	 */
	REFUND("refund", "报销", "refund", "pid", "refund_money","报销金额/元"),
	/** 
	 * 采购流程
	 */
	GOODS("goods", "物品采购", "purchase_items", "purchase_id", "item_price", "采购金额/元"),
	/**
	 * 文档审批流程 
	 */
	FILEAPPROVE("fileApprove","文档审批",null,null,null,"次"),
	/**
	 * 通用审批
	 */
	COMMONUSE("commonUse","通用审批",null,null,null,"次");
	/**
	 * 流程key
	 */
	private final String key;
	/**
	 * 流程名
	 */
	private final String procName;
	/**
	 * 流程表单tableKey
	 */
	private final String table;
	/**
	 * 表单主键
	 */
	private final String pkCol;
	/**
	 * 统计的字段，图表中体现为Y轴值
	 */
	private String col;
	/**
	 * 统计的字段名
	 */
	private String colName;

	ProcStatsEnum(String key, String procName, String table, String pkCol, String col, String colName) {
		this.key = key;
		this.procName = procName;
		this.table = table;
		this.pkCol = pkCol;
		this.col = col;
		this.colName = colName;
	}

	public String getCol() {
		return col;
	}

	public void setCol(String col) {
		this.col = col;
	}

	public String getColName() {
		return colName;
	}

	public void setColName(String colName) {
		this.colName = colName;
	}

	public String getKey() {
		return key;
	}

	public String getProcName() {
		return procName;
	}
	/**
	 * 根据tableKey返回对应数据库表
	 * @return
	 */
	public String getTable() {
		String name = null;
		if(this.table != null){
			name = OaActContants.TABLE_FIRST_NAME + this.table.toUpperCase();
		}
		return name; 
	}

	public String getPkCol() {
		return pkCol;
	}

	public static ProcStatsEnum keyOf(String proceKey) {
		for (ProcStatsEnum item : ProcStatsEnum.values()) {
			if (item.key.equals(proceKey)) {
				return item;
			}
		}
		return null;
	}
}
